package com.example.demo111111.controller;

import com.example.demo111111.entity.User;
import com.example.demo111111.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;


    @RequestMapping("/login")
    public User comparePassword( @RequestBody User user){
        User result = userService.comparePassword(user);
        return result;

    }

    @RequestMapping("/register")

    public Boolean register(@RequestBody User user){

        Boolean result = userService.registertUser(user);

       return result;
    }

    @RequestMapping ("/delete")

    public Boolean delete( @RequestBody User user){

        Boolean result = userService.delete(user);

        return result;
    }



    @PutMapping
    public Boolean update(@RequestBody User user){
        Boolean result = userService.updateUser(user);
        return result;
    }

    @RequestMapping ("/userPageList")
    public List<User>  userPageList(@RequestBody User user){
        List<User> alluser = userService.findAlluser(user);
        return alluser;
    }
    @RequestMapping ("/findUser")
    public List<User>  findUser(@RequestBody User user){
        List<User> alluser = userService.findUser(user);
        return alluser;
    }



}
